/* 
	1.该文件是对整个项目中所有的ajax请求进行，统一管理
	2.该文件中会编写一个一个的函数，项目有几个接口，那么就写几个函数
	3.这么做的优势在于：后期若接口的变更，可以更好的管理
*/
import ajax from './ajax'
import mockAjax from './mockAjax'

//请求三级分类列表
export const reqCategoryList = ()=> ajax.get('/product/getBaseCategoryList')
//请求banner数据（Home顶部的轮播区域）
export const reqBannerList = ()=> mockAjax.get('/banner')
//请求floor数据（每个楼层的数据）
export const reqFloorsList = ()=> mockAjax.get('/floors')
//请求搜索商品
export const reqGoodsInfo = (searchParams) => ajax.post('/list',searchParams)
//请求商品详情
export const reqGoodDetailInfo = (skuId) => ajax.get('/item/'+skuId)
//请求添加或更新购物车
export const reqAddOrUpdateCart = (skuId,skuNum) => ajax.post(`/cart/addToCart/${skuId}/${skuNum}`)
//请求购物车列表
export const reqCartList = () => ajax.get('/cart/cartList')
//请求勾选or取消勾选
export const reqCheckSkuInCart = (skuId,isChecked) => ajax.get(`/cart/checkCart/${skuId}/${isChecked}`)
//请求全选
export const reqCheckAllSkuInCart = (skuIdList,isChecked) => ajax.post(`/cart/batchCheckCart/${isChecked}`,skuIdList)
//请求删除购物车中的商品
export const reqDeleteSkuInCart = (skuId) => ajax.delete(`/cart/deleteCart/${skuId}`)
//请求批量删除购物车中的商品
export const reqBatchDeleteSkuInCart = (skuIdList) => ajax.delete(`/cart/batchDeleteCart`,{data:skuIdList})
//请求获取验证码
export const reqVerifyCode = (phone) => ajax.get(`/user/passport/sendCode/${phone}`)
//请求注册
export const reqRegister = (registerParams) => ajax.post('/user/passport/register',registerParams)
//请求登录
export const reqLogin = (loginParams) => ajax.post('/user/passport/login',loginParams)
//请求当前登录用户的信息（通过token，但token不体现在请求参数中，是在请求头中的）
export const reqUserInfo = ()=> ajax.get('/user/passport/auth/getUserInfo')
//请求退出登录
export const reqLogout = ()=> ajax.get('/user/passport/logout')
//请求交易页用户收货地址
export const reqUserAddressList = () => ajax.get('/user/userAddress/auth/findUserAddressList')
//请求交易页信息（商品列表、原始总金额、应支付金额）
export const reqTradeInfo = ()=> ajax.get('/order/auth/trade')
//请求提交订单
export const reqSubmitOrder = (tradeNo,params)=>ajax.post(`/order/auth/submitOrder?tradeNo=${tradeNo}`,params)
//请求订单的支付信息（二维码）
export const reqPayInfo = (orderId) => ajax.get(`/payment/weixin/createNative/${orderId}`)
//请求查询订单支付状态
export const reqPayStatus = (orderId) => ajax.get(`/payment/weixin/queryPayStatus/${orderId}`)

